import fetch from '@/utils/fetch'

export function apiGetFaultList(listQuery) {
  return fetch({
    url: '/api/v1/fault/list',
    method: 'get',
    params: listQuery
  })
}

export function apiGetFaultById(faultId) {
  return fetch({
    url: '/api/v1/fault',
    method: 'get',
    params: {
      id: faultId
    }
  })
}

export function apiAddFault(faultDto) {
  return fetch({
    url: '/api/v1/fault',
    method: 'post',
    data: faultDto
  })
}

export function apiUpdFault(faultDto) {
  return fetch({
    url: '/api/v1/fault',
    method: 'put',
    data: faultDto
  })
}

export function apiDelFault(faultId) {
  return fetch({
    url: '/api/v1/fault',
    method: 'delete',
    params: {
      id: faultId
    }
  })
}

export function apiExport (listQuery) {
  return fetch({
    url: '/api/v1/fault/export',
    method: 'post',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}
